<?php
for($i = 1; $i < $pages+1; $i++): 
    $j = $i+1;
	$atts = array('class' => 'link-class',
		  		  'OnClick' => "setanswer()");
    echo '<li>'.anchor('klausurenfragen_controller/classtest_view/'.$i, ''.$i, $atts).'</li>';
endfor ?>
<li><?php echo anchor('home/logout', 'Logout', 'class="link-class"') ?></li>